<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Class Help extends CI_Controller 
 * 反馈信息
 * @author 
 */
class Feedback extends CRUD_Controller
{
	protected $rules = array(
		"edit" => array(
			array(
				"field" => "timeline_answer",
				"label" => "回复时间",
				"rules" => "trim|strtotime"
			)
		)
	);

	protected function _index_orders(){
		return array('sort_id'=>'desc');
	}
	public function one() {
		$data = $this->input->get();
		$res = $this->model->set($data['id'],array('solve'=>$data['solve']));
		if($res) {
			//$this->_status_after($data['id'],$data['status']);
			redirect(base64_decode($data['ref']));
		}
	}
	/**
	 * @brief 默认列表页 分页
	 * @param $page 分页page值
	 */
	public function index($page=1){
		// TODO: 排序 config
		$limit = $this->page_limit;
		$this->input->get('limit') and is_numeric($this->input->get('limit')) AND $limit = $this->input->get('limit');

		// TODO 处理条件 order for search
		$where = $this->_index_where();
		if ($this->input->get('where')) {
		}
		$orders = $this->_index_orders();
		if ($this->input->get('order')) {
		}

		$fields = $this->_list_fields();

		$vdata['pages'] = $this->_pages(site_url($this->class.'/index'),$limit,$where);
		$vdata['list'] = $this->model->get_list($limit,$limit*($page-1),$orders,$where,$fields);
		$total = $this->model->get_status_nums();
		$vdata['total'] = $total['total'];
		$this->_display($vdata);
	}
}